package com.wsb.wetchat.controller;

import com.wsb.wetchat.dao.User;
import com.wsb.wetchat.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

/**
 * @author wang shaobo
 * @date 2022/6/23  17:30
 */
@RestController
public class UserController {

    @Autowired
    UserService userService;
    Lock lock = new ReentrantLock();

    @RequestMapping(value = "/user/add",method = RequestMethod.POST,produces = "application/json;charset=UTF-8")
    public void add(@RequestBody User user){



        userService.addUser(user);

    }

    @RequestMapping(value = "/user/update",method = RequestMethod.PUT,produces = "application/json;charset=UTF-8")
    public void update(@RequestBody User user){

        int i = userService.updateUser(user);

    }


}
